﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Hachi.Controllers;
using hachiModel;

public partial class usercontrols_BaiMoiDang : System.Web.UI.UserControl
{
    NewsController nctr = new NewsController();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string Lang = Session["Lang"] == null ? hachiCookies.getCookieValue("Lang") : Session["Lang"].ToString();
            List<NW_News> lst = nctr.NewsGetTopNewPost(6, Lang);


            bool IsFirstItem = true;
            foreach (NW_News item in lst)
            {
                NW_NewsDetail nd = nctr.NewsDetailGet(item, Lang);
                if (IsFirstItem)
                {
                    ltrBaiMoiDang.Text = "<div class='firstiteminlist'><a class='img'><img src='" + nd.Image + "' /></a><a href='" + nd.Alias + "' class='title'>" +
                        nd.Title + "</a><span class='summary'>" + nd.Summary + "</span></div>";
                    IsFirstItem = false;
                }
                else
                {
                    ltrBaiMoiDang.Text += "<a href='" + nd.Alias + "' onmouseover='ddrivetip(&#39;";
                    if (!string.IsNullOrEmpty(nd.Image))
                        ltrBaiMoiDang.Text += string.Format("<img class=imgtooltip src={0} />", nd.Image);
                    ltrBaiMoiDang.Text += "<strong>" + nd.Title + "</strong><br/><span class=item-time>" + item.CreatedDate.ToString("HH:mm") + "</span>&nbsp;&nbsp;|&nbsp;&nbsp; <span class=item-date>" + item.CreatedDate.ToString("dd/MM/yyyy") + "</span><br/>" + nd.Summary + "&#39;, 250);' onmouseout='hideddrivetip()'"
                        + " >" + nd.Title + "</a>";
                }
            }

        }
    }
}